package com.gxitsky.config;

import org.springframework.boot.webservices.client.HttpWebServiceMessageSenderBuilder;
import org.springframework.boot.webservices.client.WebServiceTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.ws.client.core.WebServiceTemplate;

import java.time.Duration;

/**
 * @author gxing
 * @desc
 * @date 2021/2/26
 */
@Configuration
public class WebServiceConfig {

    @Bean
    public WebServiceTemplate webServiceTemplate(WebServiceTemplateBuilder builder) {
        WebServiceTemplate template = builder.messageSenders(new HttpWebServiceMessageSenderBuilder()
                .setConnectTimeout(Duration.ofMillis(5000))
                .setReadTimeout(Duration.ofMillis(2000)).build())
                .build();
        return template;
    }


}
